Fix five compiler warnings in OpenSSL 3.x code paths#191
Draft
toddr-bot wants to merge 2 commits into
Draft
Conversation
Replace THROW macro with direct if+goto in rsa_crypt(), get_public_key_string(), sign(), and verify() — these error handlers always croak unconditionally, making the THROW-set error variable unused (-Wunused-but-set-variable). Initialize verify_result to -1 to silence -Wmaybe-uninitialized warning (the err path croaks before the switch, but the compiler cannot prove this). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
EVP_PKEY_sign_init returns 1 on success, 0 on error, or -2 if the operation is not supported. The bare truthiness check (!result) treated -2 as success. Use != 1 for consistency with the other EVP_PKEY_*_init checks in this file. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fix five compiler warnings (-Wunused-but-set-variable, -Wmaybe-uninitialized) in the OpenSSL 3.x code paths.
Why
Building with
-Wall -Wextraproduces 8 warnings. PR #185 addresses 3 of them; this PR fixes the remaining 5, making the 3.x code path warning-clean.How
4×
-Wunused-but-set-variable:rsa_crypt(),get_public_key_string(),sign(), andverify()all use theTHROWmacro which sets anerrorvariable, but theirerr:handlers unconditionally croak viaCHECK_OPEN_SSL(0)without readingerror. ReplacedTHROW(x)with directif (!(x)) goto err;and removed the unusederrordeclarations.1×
-Wmaybe-uninitialized:verify_resultinverify()could appear uninitialized to the compiler because theerr:path (which always croaks) is not provably noreturn. Initialized to-1so thedefault:switch case handles it safely.Testing
make testpasses (all 26 test files)gcc -Wall -Wextra: only the 3 warnings addressed by PR Fix three compiler warnings in RSA.xs #185 remain🤖 Generated with Claude Code